import store from '@/store'
import request from '@/utils/request'

export function dicInfo(storeKey){
	const dicts = store.getters.dicts
	let dictMap = {}
	dicts.forEach(element => {
		dictMap[element.storeKey] = element
	})
	return dictMap[storeKey]
}

export function dictOptions(storeKey){
	const dicts = store.getters.dicts
	let dictMap = {}
	dicts.forEach(element => {
		dictMap[element.storeKey] = element
	})
	return dictMap[storeKey].storeValues
}

export function dicCombo(storeKey,value){
	const dicts = store.getters.dicts
	let dictMap = {}
	dicts.forEach(element => {
		dictMap[element.storeKey] = element
	})
	let description = ''
	let values = dictMap[storeKey].storeValues
	values.forEach(e => {
		if(e.v == value){
			description = e.d
		}
	})
	
	return description
}
